package com.netease.financial.internal.di.modules;

import com.netease.financial.base.lockpattern.patternunlock.PatternUnlockPresenter;
import com.netease.financial.base.lockpattern.patternunlock.PatternUnlockPresenterImpl;
import com.netease.financial.domain.Factory;
import com.netease.financial.domain.executor.PostExecutionThread;
import com.netease.financial.domain.executor.ThreadExecutor;
import com.netease.financial.domain.interactor.CheckAccessToken;
import com.netease.financial.domain.interactor.UseCase;
import com.netease.financial.domain.repository.NfsRepository;
import com.netease.financial.internal.di.ActivityScope;

import javax.inject.Named;

import dagger.Module;
import dagger.Provides;

/**
 * Created by hzwuyufeng on 1/20/16.
 * <p/>
 * Dagger module that provides authentication related collaborators.
 */
@Module
public class PatternUnlockModule {

    private final Factory<String> mAccessToken;
    private final String mAppSecret;

    public PatternUnlockModule(Factory<String> accessToken, String appSecret) {
        mAccessToken = accessToken;
        mAppSecret = appSecret;
    }

    @Provides
    @ActivityScope
    PatternUnlockPresenter providePatternUnlockPresenter(PatternUnlockPresenterImpl patternUnlockPresenter) {
        return patternUnlockPresenter;
    }

    @Provides
    @ActivityScope
    @Named("check_access_token")
    UseCase provideCheckAccessTokenUseCase(NfsRepository nfsRepository,
                                ThreadExecutor threadExecutor,
                                PostExecutionThread postExecutionThread) {
        return new CheckAccessToken(mAccessToken, mAppSecret, nfsRepository, threadExecutor, postExecutionThread);
    }

}
